<?php

/**
 * This is the model class for table "{{r_medallas}}".
 *
 * The followings are the available columns in table '{{r_medallas}}':
 * @property integer $grid_medallas_id
 * @property integer $grid_entidad_id
 * @property string $grid_tipo_medalla
 * @property integer $grid_oro
 * @property integer $grid_plata
 * @property integer $grid_bronce
 * @property integer $grid_puesto
 * @property integer $grid_orden
 */
class RMedallas extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return RMedallas the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{r_medallas}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('grid_entidad_id, grid_tipo_medalla', 'required'),
			array('grid_entidad_id, grid_oro, grid_plata, grid_bronce, grid_puesto, grid_orden', 'numerical', 'integerOnly'=>true),
			array('grid_tipo_medalla', 'length', 'max'=>10),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('grid_medallas_id, grid_entidad_id, grid_tipo_medalla, grid_oro, grid_plata, grid_bronce, grid_puesto, grid_orden', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'grid_medallas_id' => 'Grid Medallas',
			'grid_entidad_id' => 'Grid Entidad',
			'grid_tipo_medalla' => 'Grid Tipo Medalla',
			'grid_oro' => 'Grid Oro',
			'grid_plata' => 'Grid Plata',
			'grid_bronce' => 'Grid Bronce',
			'grid_puesto' => 'Grid Puesto',
			'grid_orden' => 'Grid Orden',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('grid_medallas_id',$this->grid_medallas_id);
		$criteria->compare('grid_entidad_id',$this->grid_entidad_id);
		$criteria->compare('grid_tipo_medalla',$this->grid_tipo_medalla,true);
		$criteria->compare('grid_oro',$this->grid_oro);
		$criteria->compare('grid_plata',$this->grid_plata);
		$criteria->compare('grid_bronce',$this->grid_bronce);
		$criteria->compare('grid_puesto',$this->grid_puesto);
		$criteria->compare('grid_orden',$this->grid_orden);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}